﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Gobang
{
    class Piece: PictureBox
    {
        public static int PIECE_R = 60;
        public int i;
        public int j;
        public Piece() { }
        public Piece(int x, int y)
        {
            i = x;
            j = y;
            x = StaticData.OFFSET_X + StaticData.GRID_X * x;
            y = StaticData.OFFSET_Y + StaticData.GRID_Y * y;
            this.SetPosition(x - PIECE_R/2, y - PIECE_R/2);
            this.Size = new System.Drawing.Size(PIECE_R, PIECE_R);
            this.BackColor = System.Drawing.Color.Transparent;
            this.SizeMode = PictureBoxSizeMode.Zoom;
            this.BringToFront();
        }
        public void SetPosition(int x, int y)
        {
            this.Location = new System.Drawing.Point(x, y);
        }
    }

    class WhitePiece : Piece
    {
        public WhitePiece(int x, int y) : base(x,y)
        {
            this.Image = Properties.Resources.white;
        }
    }

    class BlackPiece : Piece
    {
        public BlackPiece(int x, int y) : base(x,y)
        {
            this.Image = Properties.Resources.black;
        }
    }
}
